package com.myfoon.model.entity;


import com.tangosol.io.ExternalizableLite;

import com.tangosol.util.ExternalizableHelper;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;

import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name = "USER_PI")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class UserPi implements Serializable {    
    private Long id;
    private String fullname;
    private Boolean gender;
    private Date birthdate;
    private Country country;
    
    public UserPi() {
    }

    public UserPi(String fullname, Boolean gender, Date birthdate,
                  Country country) {
        super();    
        this.fullname = fullname;
        this.gender = gender;
        this.birthdate = birthdate;
        this.country = country;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Id 
    @GeneratedValue(generator = "UserPiSequence", strategy = GenerationType.AUTO)
    @SequenceGenerator(name = "UserPiSequence", allocationSize = 1, sequenceName = "USER_PI_SEQ_01")
    @Column(name = "ID", unique = true, nullable = false)
    public Long getId() {
        return id;
    }
        
    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    @Column(name = "FULLNAME", length=50, nullable = false)
    public String getFullname() {
        return fullname;
    }

    public void setGender(Boolean gender) {
        this.gender = gender;
    }

    @Column(name = "GENDER", nullable = false, precision = 1, scale = 0)
    public Boolean getGender() {
        return gender;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    @Column(name = "BIRTHDATE")
    public Date getBirthdate() {
        return birthdate;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "COUNTRY_ID")
    public Country getCountry() {
        return country;
    }    
}
